//
//  DeviceCtrl.m
//  sensen_ios
//
//  Created by hebidu on 16/4/30.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "DeviceCtrl.h"

@implementation DeviceCtrl


+(NSString *) getPPPPCloseMsg:(int)errCode{
    switch (errCode) {
        case ERROR_PPPP_SUCCESSFUL:
            NSLog(@"PPPP关闭成功");
            return @"PPPP关闭成功";
            break;
        case ERROR_PPPP_NOT_INITIALIZED:
            NSLog(@"PPPP 未初始化");
            return @"PPPP 未初始化";
            break;
        case ERROR_PPPP_INVALID_SESSION_HANDLE:
            NSLog(@"PPPP 无效会话句柄");
            return @"PPPP 无效会话句柄";
            break;
            
        default:
            NSLog(@"PPPP 关闭结果未知");
            return @"PPPP关闭结果未知";
            break;
    }

}

+(NSString *) getPPPPConnectErrMsg:(int) errCode{
    
    switch(errCode){
        case ERROR_PPPP_NOT_INITIALIZED:
            return @"PPPP 未初始化";
            break;
            
        case ERROR_PPPP_TIME_OUT:
            return @"PPPP 连接超时";
            break;
            
        case ERROR_PPPP_INVALID_ID:
            return @"PPPP 无效设备ID";
            break;
            
        case ERROR_PPPP_INVALID_PREFIX:
            return @"PPPP 设备DID与initString不匹配";
            break;
            
        case ERROR_PPPP_DEVICE_NOT_ONLINE:
            return @"设备不在线";
            break;
            
        case ERROR_PPPP_NO_RELAY_SERVER_AVAILABLE:
            return @"PPPP没有可用的服务器";
            break;
        case ERROR_PPPP_MAX_SESSION:
            return @"太多的应用连接到了设备";
            break;
            
        case ERROR_PPPP_UDP_PORT_BIND_FAILED:
            return @"PPPP UDP端口绑定失败";
            break;
        case ERROR_PPPP_USER_CONNECT_BREAK:
            return @"PPPP 用户连接断开";
            break;
        default:
            return @"未知错误";
            break;
    }
}

+(NSString *) getiPNInitErrMsg:(int )errCode{

    return  [NSString stringWithFormat:@"%d",errCode];
}


+(NSString *) getiPNErrMsg:(int ) errCode {
    
    switch (errCode) {
        case iPN_Error_Invalid_Token:
            return @"iPN 无效Token";
            break;
        case iPN_Error_Event_Exist:
            return @"iPN 事件已经存在";
            break;
        case iPN_Error_SubscriberID_NotExist:
            return @"iPN 订阅ID不存在";
            break;
        case iPN_Error_Internal_Error:
            
            return @"iPN 内部错误";
            break;
        case iPN_Error_Table_NotExist:
            return @"iPN 表不存在";
            break;
        case iPN_Error_Already_Published:
            
            return @"iPN 已经发布";
            break;
        case iPN_Error_Already_Subscribed:
            
            return @"iPN 已经订阅";
            
            break;
            
        case iPN_Error_Connect_TimeOut:
            
            return @"iPN 连接超时";
            break;
            
        case iPN_Error_Max_Event:
            //需要把之前的UnPublish掉
            return @"iPN 最大事件";
            break;
            
        case iPN_Error_Already_Posted:
            return @"iPN 已经提交";
            break;
        case iPN_Error_Event_NotExist:
            return @"iPN 事件不存在";
            break;
        default:
            return @"iPN 未知错误";
            break;
    }
    
}

+(NSString *) getPPPPWriteMsg:(int ) errCode{
    if(errCode > 0){
        return @"PPPP 写入成功";
    }
    switch (errCode) {
        case ERROR_PPPP_NOT_INITIALIZED:
            return @"PPPP 写入 未初始化";
            break;
        case ERROR_PPPP_INVALID_PARAMETER:
            return @"PPPP 写入 无效的参数";
            break;
        case ERROR_PPPP_INVALID_SESSION_HANDLE:
            
            return @"PPPP 写入 无效的会话句柄";
            break;
        case ERROR_PPPP_SESSION_CLOSED_REMOTE:
            return @"PPPP 写入 远程会话已关闭";
            break;
        case ERROR_PPPP_SESSION_CLOSED_TIMEOUT:
            return @"PPPP 写入 会话关闭超时";
            break;
            
        default:
            return @"PPPP 未知写入错误";
            break;
    }
}


+(NSString *) getPPPPReadMsg:(int ) errCode{
    switch (errCode) {
        case ERROR_PPPP_SUCCESSFUL:
            return @"PPPP 成功";
            break;
        case ERROR_PPPP_NOT_INITIALIZED:
            return @"PPPP 读取 未初始化";
            break;
        case ERROR_PPPP_TIME_OUT:
            return @"PPPP 读取超时";
            break;
        case ERROR_PPPP_INVALID_SESSION_HANDLE:
            
            return @"PPPP 读取 无效的会话句柄";
            break;
        case ERROR_PPPP_SESSION_CLOSED_REMOTE:
            return @"PPPP读取 远程会话已关闭";
            break;
        case ERROR_PPPP_SESSION_CLOSED_TIMEOUT:
            return @"PPPP 读取 会话关闭超时";
            break;
            
        default:
            return @"PPPP 未知读取错误";
            break;
    }
}


@end
